const express = require('express');
const router = express.Router();
//process.cwd(): 返回Node.js进程的当前工作目录,就是node命令运行的那个文件夹的路径
const userController = require("../controller/user.js")

// 中间件
const expressJoi = require('@escook/express-joi')
const user_schema = require('../utils/schema/user')
router.get("/", (req, res) => {
  console.log("okk");
  res.cc("ok");
})
// 教师端
router.post('/login', expressJoi(user_schema.login_schema), (req, res) => userController.userLogin(req, res));
router.post('/register', expressJoi(user_schema.reg_login_schema), (req, res) => userController.userRegister(req, res));

// 家长
router.get('/parents/select/:phone', expressJoi(user_schema.parents_select_schema), (req, res) => userController.parentsSelect(req, res))
// 查询成功后 确认注册
router.post("/parents/register", expressJoi(user_schema.parents_register_schema), (req, res) => userController.parentsRegister(req, res))
// 登录
router.post("/parents/login", expressJoi(user_schema.parents_login_schema), (req, res) => userController.parentsLogin(req, res))

module.exports = router;
